// =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
// Create namespace in which to store classes
// =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
if (_global.neutron =  = undefined) {
  _global.neutron = new Object( );
}
// =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
// Create the Ball class
// =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
/*
 * Neutron Class. Extends MovieClip.
 *
 * Desc: A movie subclass for depicting Neutrons
 *       Requires a library symbol named neutronSymbol.
 *
 * Constructor Params:
 *   radius 		-The neutrons radius
 *   neutronColor	-The neutrons color
 *   x			-The neutrons initial x position
 *   y			-The neutrons initial y position
 *   velocity		-The neutrons movement vector: {x:0, y:0}
 *
 * Methods:
 *   setSize()		-Make neutrons size match the supplied radius
 *   setPosition()	-Place the ball at an (x,y) coordinate
 *   setColor()		-Apply and RGB color value to the ball clip
 *   move()		-Apply the ball's velocity vector to its position and
 *
 * Event Handlers:
 *   onEnterFrame()	-Invokes move() and checkhit() every frame
 */
/*
 * Neutron Class Constructor (parameters are passed by attachMovie()'s initObj)
 */
Neutron = function () {
  // Create instance properties
  this.velocity = this.params.velocity;
  // Initialize instance
  this.setPosition(this.params.x, this.params.y);
  this.setColor(this.params.neutronColor);
  this.setSize(this.params.radius);
  this.onEnterFrame = this.move;
  delete this.params;
)
/* 
 * Set MovieClip as Neutron's superclass
 */
Neutron.prototype = new MovieClip();
/*
 * Associate the library's neutronSymbol with the Neutron class
 */
Object.registerClass("neutronSymbol", Neutron);
/*
 * Instance Methods
 */
/*
 * Method: Neutron.setSize()
 *   Desc: sets the neutron clip's size
 * 
 * Params:
 *   newRadius		-the neutron's new radius
 */
Neutron.prototype.setSize = function (newRadius) {
  this._width = this._height = (newRadius *2);
};
/*
 * Method: Neutron.setColor()
 *   Desc: sets the neutron clip's color
 * 
 * Params:
 *   newColor		-the neutron's new color (RGB value)
 */
Neutron.prototype.setColor = function (newColor) {
  var col = new Color(this);
  col.setRGB(newColor);
};
/*
 * Method: Neutron.move( )
 *   Desc: Moves the neutron according to its velocity vector
 *
 * Params: None
 *
 */
Neutron.prototype.move = function (){
  this._x += this.velocity.x;
  this._y += this.velocity.y;
}  

